package com.suredy.app.dm.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.springframework.format.annotation.DateTimeFormat;

import com.suredy.app.dm.constants.DmOpTypes;
import com.suredy.core.model.BaseModel;

/**
 * 数据维护日志模型
 * 
 * @author VIVID.G
 * @since 2016-4-1
 * @version v0.1
 */
@Entity
@Table(name = "tb_dm_op_log")
public class DmOpLog extends BaseModel {

	private static final long serialVersionUID = 1L;

	/* 操作类型 */
	@Column(length = 20, nullable = false)
	@Enumerated(EnumType.STRING)
	private DmOpTypes type;

	/* 操作人员 */
	@Column(length = 200, nullable = false)
	private String operator;

	/* 操作日期 */
	@Column(nullable = false)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
	private Date time;

	/* 操作内容 */
	@Column(columnDefinition = "text", nullable = false)
	private String logs;

	// for search
	@Transient
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
	private Date start;
	@Transient
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
	private Date end;

	public DmOpTypes getType() {
		return type;
	}

	public void setType(DmOpTypes type) {
		this.type = type;
	}

	public String getOperator() {
		return operator;
	}

	public void setOperator(String operator) {
		this.operator = operator;
	}

	public Date getTime() {
		return time;
	}

	public void setTime(Date time) {
		this.time = time;
	}

	public String getLogs() {
		return logs;
	}

	public void setLogs(String logs) {
		this.logs = logs;
	}

	public Date getStart() {
		return start;
	}

	public void setStart(Date start) {
		this.start = start;
	}

	public Date getEnd() {
		return end;
	}

	public void setEnd(Date end) {
		this.end = end;
	}

}
